﻿@model InformationCenter.Models.ArticleList

@{
    ViewBag.Title = "Create";
}

<section class="wrapper site-min-height">
    <!-- page start-->
    <section class="panel">
        <header class="panel-heading">
            新建文章
        </header>
        <div class="panel-body">
            @using (Html.BeginForm("Create","ArticleLists",FormMethod.Post,new {onsubmit = "return onFormSubmit()" ,enctype = "multipart/form-data" }))
            {
                            @Html.AntiForgeryToken()

                            <div class="form-horizontal">
                    @Html.ValidationSummary(true, "", new {@class = "text-danger"})
                    <div class="form-group">
                        @Html.LabelFor(model => model.Name, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.Name, new {htmlAttributes = new {@class = "form-control"}})
                            @Html.ValidationMessageFor(model => model.Name, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.SeoKeyword, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.SeoKeyword, new {htmlAttributes = new {@class = "form-control"}})
                            @Html.ValidationMessageFor(model => model.SeoKeyword, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.SeoSummary, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">
                            @Html.TextAreaFor(model => model.SeoSummary,htmlAttributes: new {@class= "form-control  t-text-area" })
                            @Html.ValidationMessageFor(model => model.SeoSummary, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Picture, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">
                            
                            <div class="fileupload fileupload-new" data-provides="fileupload">
                                <div class="fileupload-new thumbnail" style="width: 200px; height: 150px;">
                                    <img src="\img\no-image.png" alt=""/>
                                </div>
                                <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;"></div>
                                <div>
                                    <span class="btn btn-white btn-file">
                                        <span class="fileupload-new"><i class="fa fa-paper-clip"></i> Select image</span>
                                        <span class="fileupload-exists"><i class="fa fa-undo"></i> Change</span>
                                        <input type="file" name="Picture" class="default" />
                                     
                                    </span>
                                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash"></i> Remove</a>
                                </div>
                            </div>

                            @Html.ValidationMessageFor(model => model.Picture, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Category, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">

                            @Html.DropDownListFor(model => model.Category, ViewData["Type"] as SelectList, new {@class= "btn btn-white dropdown-toggle" })

                            @Html.ValidationMessageFor(model => model.Category, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    <div class="form-group">
                        @Html.LabelFor(model => model.Writer, htmlAttributes: new {@class = "control-label col-md-2"})
                        <div class="col-md-10">
                            @Html.EditorFor(model => model.Writer, new {htmlAttributes = new {@class = "form-control"}})
                            @Html.ValidationMessageFor(model => model.Writer, "", new {@class = "text-danger"})
                        </div>
                    </div>

                    @Html.HiddenFor(model => model.Context ,new {id = "Context"})
                    <!--Summernote start-->
                    <div class="row">
                        <div class="col-md-12">
                            <section class="panel">
                                <header class="panel-heading head-border">
                                    正文
                                </header>
                                <div class="panel-body">
                                    <div class="summernote">
                                        
                                    </div>
                                </div>
                            </section>
                        </div>
                    </div>
                    <!--Summernote end-->


                    <div class="form-group">
                        <div class="col-md-offset-2 col-md-10">
                            <input type="submit"  value="Create" class="btn btn-danger" />
                        </div>
                    </div>
                </div>
            }

            <div>
                @Html.ActionLink("Back to List", "Index", "", new {@class = "btn btn-info"})
            </div>
        </div>
    </section>
    <!-- page end-->
</section>

@section footerSection{
<script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/assets/bootstrap-fileupload/bootstrap-fileupload.css" />
    <script type="text/javascript" src="/assets/bootstrap-fileupload/bootstrap-fileupload.js"></script>
    <!--summernote-->
<script src="/assets/summernote/dist/summernote.min.js"></script>
<script>
      jQuery(document).ready(function(){

          $('.summernote').summernote({
              height: 200,                 // set editor height

              minHeight: null,             // set minimum height of editor
              maxHeight: null,             // set maximum height of editor
              
              focus: true                 // set focus to editable area after initializing summernote
          });
      });

      function onFormSubmit() {
          $("#Context").val($('.summernote').eq(0).code());
          return true;
      }
      
</script>
}


